﻿using AlibabaCloud.SDK.Ocr_api20210707;
using Klear.Library.Models;

namespace Klear.Library.Services;

public class InterfaceService : IInterfaceService
{
    
    //每日简讯
    public async Task<DailyInfoModel> GetDailyInfoAsync()
    {
        DatabaseService databaseService = new DatabaseService();
        DateTime today = DateTime.Now.Date;
        DailyInfoModel info=new DailyInfoModel();
        DailyInfoModel res=await databaseService.FindTodayInfo(today);
        if (res  is null)
        {
            //公历农历
            ChineseAlmanacService almanac = new ChineseAlmanacService();
            AlmanacModel almanacModel =await almanac.RunAsync();
            info.GreCalendar = almanacModel.Gregoriandate;
            info.TraCalendar = almanacModel.Lunardate;
            //新闻
            NewsService news=new NewsService();
            info.News =await news.GetFirstNews();
            //天气
            WeatherService weather = new WeatherService();
            info.Weather =await weather.GetWeather();
            info.Date = today;

            await databaseService.AddDailyInfo(info);
        }

        return res;
    }
    // OCR相关
    public void OcrInterfaceAsync()
    {
        throw new NotImplementedException();
    }
    
    // 大模型相关
    public Task<IncomeAndExpensesModel> LlmSendPrompt(string billContent)
    {
        throw new NotImplementedException();
    }
}